import { createRouter, createWebHashHistory } from 'vue-router'
import BasicSettingsModule from './modules/basic-settings-module'
import BidEvaluation from './modules/bid-evaluation'
import CommonFunctions from './modules/common-functions'
import Common from './modules/common'
import type { RouterTypes } from '~/basic'
import Layout from '@/layout/index.vue'
export const constantRoutes: RouterTypes = [
  ...Common,
  {
    path: '/',
    name: 'dashboard',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: { title: 'Dashboard', icon: 'ZhongChen', affix: true }
      }
    ]
  },
  BasicSettingsModule,
  BidEvaluation,
  CommonFunctions,
  { path: '/:pathMatch(.*)', redirect: '/404', hidden: true }
]

//角色和code数组动态路由
export const roleCodeRoutes: RouterTypes = []

export const asyncRoutes: RouterTypes = [
  // 404 page must be placed at the end !!!
]

const router = createRouter({
  history: createWebHashHistory(),
  scrollBehavior: () => ({ top: 0 }),
  routes: constantRoutes
})

export default router
